var api=new function(){
	var self=this;
	this.nosql=new function(){
		var getBucket=this.getBucket=function(bucket){
			if(typeof(localStorage[bucket])=='undefined'){
				localStorage[bucket]=JSON.stringify({});
			}
			return JSON.parse(localStorage[bucket]);
		};
		
		var setBucket=this.setBucket=function(bucket,hash){
			localStorage[bucket]=JSON.stringify(hash);
		};
		
		this.get=function(bucket,key){
			var b=getBucket(bucket);
			if(typeof(b[key])!=='undefined')return b[key];
		};
		
		this.set=function(bucket,key,value){
			var b=getBucket(bucket);
			b[key]=value;
			setBucket(bucket,b);
		};
		
		this.del=function(bucket,key){
			var b=getBucket(bucket);
			if(typeof(b[key])!=='undefined') delete b[key];
			setBucket(bucket,b);
		};
		
		this.list=function(bucket){
			return getBucket(bucket);
		};
		
		this.remove=function(bucket){
			if(typeof(localStorage[bucket])!='undefined')delete localStorage[bucket];
		};
	};
}